<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Insert title here</title>
	</head>

	<body>
		<div class="pageHeader">
			<div class="searchBar" >
				<form action="${pageContext.request.contextPath }/UserPhoneServlet" method="post" onsubmit="return navTabSearch(this);" id="upl_filterform">
					<input type="hidden" name="opt" value="userfilter">
					<ul class="searchContent" style="float: left;">
						<li>
							<select name="dept_id" style="margin-left: 20px;" id="upl_dept" >
								<option value="0">选择部门</option>
								<c:forEach items="${depts }" var="d">
									<c:choose>
										<c:when test="${d.id == smssession.dept_id }">
											<option selected="selected" value="${d.id }">${d.d_name }</option>
										</c:when>
										<c:otherwise>
											<option value="${d.id }">${d.d_name }</option>
										</c:otherwise>
									</c:choose>
								</c:forEach>							
							</select>
							<select name="company" style="margin-left: 20px;">
								<option value="0">选择公司</option>
								<c:forEach items="${compNames }" var="compName">
									<c:choose>
										<c:when test="${compName == smssession.u_company }">
											<option selected="selected" value="${compName }">${compName }</option>
										</c:when>
										<c:otherwise>
											<option value="${compName }">${compName }</option>
										</c:otherwise>
									</c:choose>
								</c:forEach>
							</select>
						</li>
						<li>按姓名：
							<input name="u_name" type="text" value="${smssession.u_name }">
						</li>
						<li>按手机号：
							<input name="u_phoneno" type="text" value="${smssession.u_phoneno }">
						</li>
					</ul>
					<div class="buttonActive" style="float: left;"><div class="buttonContent"><button type="submit">查询</button></div></div>
				</form>
			</div>
		</div>
		<div class="pageContent">
			<div class="panelBar">
				<ul class="toolBar">
					<li><a href="${pageContext.request.contextPath }/UserPhoneAjax?opt=addtoNote" rel="up_id" target="selectedTodo" class="add" title="确定要加入通讯录吗？"><span>加入通讯录</span></a></li>
					<li><a href="${pageContext.request.contextPath }/UserPhoneServlet?opt=notelist" rel="notelist" target="navTab" class="icon" title="通讯录"><span>生成通讯录去</span></a></li>
					<li><a href="${pageContext.request.contextPath }/UserPhoneServlet?opt=upedit&up_id={up_id}" rel="upedit" target="dialog" class="edit" width="800" height="450"><span>编辑</span></a></li>
					<li><a href="${pageContext.request.contextPath }/UserPhoneServlet?opt=upadd" rel="upadd" target="dialog" class="add" width="800" height="450"><span>添加</span></a></li>
					<li><a href="${pageContext.request.contextPath }/UserPhoneAjax?opt=delup&up_id={up_id}" target="ajaxTodo" class="delete" title="确定删除吗？"><span>删除</span></a></li>
					<li><a href="${pageContext.request.contextPath }/UserPhoneServlet?opt=deptadd" rel="deptadd" target="dialog" class="add" width="350" height="200"><span>添加部门</span></a></li>
				</ul>
			</div>
			<table class="table" width="98%" layoutH="85">
				<thead>
					<tr>
						<th width="50">序号</th>
						<th width="30"><input type="checkbox" class="checkboxCtrl" group="up_id"></th>
						<th width="100">姓名</th>
						<th width="120">手机号码</th>
						<th width="80">PASSWORD</th>
						<th width="150">手机硬件MEID</th>
						<th width="100">手机类型</th>
						<th width="100">部门</th>
						<th width="60">公司</th>
						<th>备注</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${userPhones }" var="up" varStatus="i">
						<tr target="up_id" rel="${up.id }">
							<td>${i.count }</td>
							<td><input type="checkbox" name="up_id" value="${up.id }"></td>
							<td>${up.u_name }</td>
							<td>${up.u_phoneno }</td>
							<td>${up.u_phonepswd }</td>
							<td>${up.u_phonemeid }</td>
							<td>${up.u_phonetype }</td>
							<td>${up.dept.d_name }</td>
							<td>${up.u_company }</td>
							<td>${up.u_remark }</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
		
		<script type="text/javascript">
			$(function(){
				$("#upl_dept").change(function(){
					$("#upl_filterform").submit();
				});
			});
		</script>
	</body>

</html>